/**
 * -----------------------------------
 *  Copyright (c) 2021-2025
 *  All rights reserved, Designed By www.linfengtech.cn
 *  林风社交论坛商业版本请务必保留此注释头信息
 *  商业版授权联系技术客服	 QQ:  3582996245
 *  严禁分享、盗用、转卖源码或非法牟利！
 *  版权所有 ，侵权必究！
 * -----------------------------------
 */
package io.linfeng.modules.app.controller;

import io.linfeng.common.annotation.NoRepeatSubmit;
import io.linfeng.common.utils.R;
import io.linfeng.common.utils.Result;
import io.linfeng.common.vo.AppCashInfoResponse;
import io.linfeng.modules.admin.entity.AppUserEntity;
import io.linfeng.modules.admin.service.CashOutService;
import io.linfeng.modules.app.annotation.Login;
import io.linfeng.modules.app.annotation.LoginUser;
import io.linfeng.modules.app.param.AddCashOutForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;


/**
 * 提现模块
 *
 * @author JL.Yu
 * @date 2023-02-01 12:42:16
 */
@RestController
@RequestMapping("app/cashOut")
@Api(tags = "移动端——提现")
public class AppCashOutController {
    @Autowired
    private CashOutService cashOutService;



    @Login
    @PostMapping("/submit")
    @ApiOperation("用户提交提现申请")
    @NoRepeatSubmit
    public R save(@RequestBody AddCashOutForm param,@ApiIgnore @LoginUser AppUserEntity user){

        cashOutService.submit(param,user.getUid());
        return R.ok();
    }

    @Login
    @GetMapping("/getAccountBasicInfo")
    @ApiOperation("查询账户基本信息")
    public Result<AppCashInfoResponse> getAccountBasicInfo(@ApiIgnore @LoginUser AppUserEntity user){
        AppCashInfoResponse vo =cashOutService.getAccountBasicInfo(user.getUid());
        return new Result<AppCashInfoResponse>().ok(vo);
    }


}
